'  __ _                 
' / _| |                
'| |_| |_   _ _ __ _ __ 
'|  _| | | | | '__| '__|
'| | | | |_| | |  | |   
'|_| |_|\__,_|_|  |_|

'Copyright (C) 2012, Rafal Marek Chmiel
'All rights reserved. http://flurr.codeplex.com/

'This file is part of the TwitterVB software
'Copyright (C) 2009, Duane Roelands
'All rights reserved.

'TwitterVB is a port of the Twitterizer library (http://code.google.com/p/twitterizer/)
'Copyright (C) 2008, Patrick "Ricky" Smith (ricky@digitally-born.com)
'All rights reserved.

' Redistribution and use in source and binary forms, with or without modification, are 
' permitted provided that the following conditions are met:
'
' - Redistributions of source code must retain the above copyright notice, this list 
'   of conditions and the following disclaimer.
' - Redistributions in binary form must reproduce the above copyright notice, this list 
'   of conditions and the following disclaimer in the documentation and/or other 
'   materials provided with the distribution.
'
' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
' ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
' WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
' IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
' INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
' NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
' PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
' WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
' ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
' POSSIBILITY OF SUCH DAMAGE.E USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
' POSSIBILITY OF SUCH DAMAGE.

Namespace twitter

    Public Class twitterTrendLocation
        Private _ID As String = String.Empty
        Private _LocationName As String = String.Empty
        Private _PlaceTypeCode As String = String.Empty
        Private _PlaceTypeName As String = String.Empty
        Private _CountryName As String = String.Empty
        Private _CountryCode As String = String.Empty
        Private _URL As String = String.Empty


        Public Property ID() As String
            Get
                Return _ID
            End Get
            Set(ByVal value As String)
                _ID = value
            End Set
        End Property


        Public Property LocationName() As String
            Get
                Return _LocationName
            End Get
            Set(ByVal value As String)
                _LocationName = value
            End Set
        End Property


        Public Property PlaceTypeCode() As String
            Get
                Return _PlaceTypeCode
            End Get
            Set(ByVal value As String)
                _PlaceTypeCode = value
            End Set
        End Property


        Public Property PlaceTypeName() As String
            Get
                Return _PlaceTypeName
            End Get
            Set(ByVal value As String)
                _PlaceTypeName = value
            End Set
        End Property


        Public Property CountryName() As String
            Get
                Return _CountryName
            End Get
            Set(ByVal value As String)
                _CountryName = value
            End Set
        End Property


        Public Property CountryCode() As String
            Get
                Return _CountryCode
            End Get
            Set(ByVal value As String)
                _CountryCode = value
            End Set
        End Property


        Public Property URL() As String
            Get
                Return _URL
            End Get
            Set(ByVal value As String)
                _URL = value
            End Set
        End Property


        Public Sub New(ByVal SearchResultNode As Xml.XmlNode)
            Me._ID = SearchResultNode("woeid").InnerText

            If SearchResultNode("name") IsNot Nothing Then
                Me._LocationName = SearchResultNode("name").InnerText
            End If

            If SearchResultNode("placeTypeName") IsNot Nothing Then
                Me._PlaceTypeName = SearchResultNode("placeTypeName").InnerText
            End If

            Dim PTNList As Xml.XmlNodeList = SearchResultNode.SelectNodes("placeTypeName")

            If PTNList(0).Attributes("code") IsNot Nothing Then
                Me._PlaceTypeCode = PTNList(0).Attributes("code").Value
            End If

            If SearchResultNode("country") IsNot Nothing Then
                Me._CountryName = SearchResultNode("country").InnerText
            End If

            Dim CountryList As Xml.XmlNodeList = SearchResultNode.SelectNodes("country")

            If CountryList(0).Attributes("code") IsNot Nothing Then
                Me._CountryCode = CountryList(0).Attributes("code").Value
            End If

            If SearchResultNode("url") IsNot Nothing Then
                Me._URL = SearchResultNode("url").InnerText
            End If
       End Sub
    End Class

End Namespace